POV-Ray : Newsgroups : povray.text.scene-files : Newbies Animating sky_sphere colour_map linked to SunPos : Newbies Animating sky_sphere colour_map linked to SunPos Server Time
28 Jun 2024 22:57:18 EDT (-0400)
  Newbies Animating sky_sphere colour_map linked to SunPos  
From: Phil Cook
Date: 2 Oct 2003 12:15:54
Message: <oprwfbhgleeybzwd@news.povray.org>
I hope this is the right place to post this if not no offence is intended.

I model a lot of outdoor stuff and use the excellent SunPos macro to 
calculate the position of the sun. I would like to animate this by 
altering the sun's position, this of course I can do easily, however the 
sky_sphere colour won't match the sun position( blue sky at sunset etc.)

Using the old adage of try and work it out yourself, I have written a 
little macro that seems to solve this. Before I get too involved with it, 
altering light colour and creating a much better sun, I would really like 
to get some comments as to my script and the colours used.

All comments are appreciated.

--
Phil

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


//code start
#version 3.5;
global_settings{assumed_gamma 1}

#include "sunpos.inc"

//just to initiate SunPos
#declare lightposition = SunPos(2003, 10, 2, 06, 00, 0, 51.4667, 0.00);

//RERUN SolarPostion but bring in by a factor of 100 to see Sphere
#declare newSolarPosition=vrotate(<0,0,10000000>,<-Al,Az,0>);

#macro SunColourMacro()
#switch (newSolarPosition.y)

#range(-3000000, -2500000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.15 rgb <1,0.5,0.1>]
[0.2 rgb <172,163,146>/255]
[0.4 rgb <0,0,0>]};
#break

#range(-2500000, -1500000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.3 rgb <1,0.5,0.1>]
[0.4 rgb <172,163,146>/255]
[0.6 rgb <0,0,0>]};
#break

#range(-1500000,-1000000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.45 rgb <1,0.5,0.1>]
[0.6 rgb <172,163,146>/255]
[0.8 rgb <0,0,0>]};
#break

#range(-1000000,1000000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.6 rgb <1,0.5,0.1>]
[0.8 rgb <0,0,1>]
[1 rgb <0,0,0>]};
#break

#range(1000000,3000000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.6 rgb <1,0.5,0.1>]
[0.8 rgb <0,0,1>]
[1 rgb <0,0,0>]};
#break

#range(3000000,4500000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.4 rgb <1,0.5,0.1>]
[0.5 rgb <172,163,146>/255]
[1 rgb <0,0,1>]
[1 rgb <0,0,0>]};
#break

#range(4500000,9000000)
#declare Skycolour =
colour_map{
[0 rgb <1,0,0>]
[0.4 rgb <1,0.5,0.1>]
[0.4 rgb <172,163,146>/255]
[1 rgb <0,0,1>]
[1 rgb <0,0,0>]};
#break
#end
#end


//sky
#declare MySkySphere=
sky_sphere{
SunColourMacro()
pigment{
gradient y
colour_map{
Skycolour}
scale 2 translate -1}};
sky_sphere{MySkySphere}

//clouds
plane{<0,1,0>,1 texture{
pigment{bozo warp{turbulence 0.4 octaves 6  omega 0.7 lambda 2}
colour_map{
[0.0 rgb <0.95, 0.95, 0.95>]
[0.1 rgb <0.85, 0.85, 0.85>]
[0.5 rgbt <1, 1, 1, 1> ]
[1.0 rgbt <1, 1, 1, 1> ]}
rotate<10,20,0>
scale <0.3, 0.4, 0.3>*3 }
finish {ambient 1 diffuse 0}}
scale 1000}

#declare Suncolour = rgb<247/255,255/255,58/255>;

//adjust sphere to match apparent size
#declare MySphere= sphere{<0,0,0> 250000 pigment{colour Suncolour} 
finish{ambient 1 diffuse 0}}

//Use rejigged SolarPosition
light_source {newSolarPosition rgb 1 looks_like {MySphere}}

camera{
location <0,10,-150>
look_at <0,10,10>
}


plane{y,0 texture {pigment{rgb <0.6,0.8,0.196078>*0.9} normal {bumps 0.5 
scale 0.01} finish {ambient 0.45 diffuse 0.55}}}
//code end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.